package com.telsoft.data;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.Vector;

import com.telsoft.business.DAOHelperBusiness;
import com.telsoft.entity.GroupComponentEntity;

public class GroupComponentDAO {
	public List<GroupComponentEntity> getGRComponent() throws SQLException{
		List<GroupComponentEntity> grComponents = new Vector<GroupComponentEntity>();
		Connection conn = DAOHelperBusiness.getConnection();
		Statement stm = DAOHelperBusiness.getStatement(conn);
		String sql = "SELECT * FROM GROUP_COMPONENT";
		ResultSet rs = stm.executeQuery(sql);
		while (rs.next()){
			GroupComponentEntity grComponent = new GroupComponentEntity();
			grComponent.setGrComID(rs.getInt("GRCOM_ID"));
			grComponent.setLibID(rs.getInt("LIB_ID"));
			grComponent.setName(rs.getString("NAME"));
			grComponent.setDetail(rs.getString("DETAIL"));
			grComponents.add(grComponent);			
		}
		DAOHelperBusiness.closeStatement(stm);
		DAOHelperBusiness.closeConnection(conn);
		return grComponents;
	}
}
